<?php
/**
 * This file is part of the Agora distribution. 
 * Detailed copyright and licensing information can be found
 * in the gpl-3.0.txt file which should be included in the distribution.
 * 
 * @version		$Id: 3.0.14 Olympus 2010-09-28 rammstein4o $
 * @copyright  2007 - 2010 jVitals
 * @license   GPLv3 Open Source
 * @link       http://jvitals.com
 * @since      File available since initial release
 */

	defined ('IN_AGORA') or die;

	class TaskController extends AgoraPMSController
	{
		function _default()
		{
			$id = (int)Agora::getVar('id');
			$pm_model = & Model::getInstance('PMSModel');
			$user_model = &Model::getInstance('UserModel');
			$post = $pm_model->load($id);
			
			$user = $user_model->load($post['sender_id']); 
			$post['sender_fullname'] = $user_model->getUserFullName($user['username']);
			
			if ($post['sender_id'] != $this->agora_user['id'] && $post['owner'] != $this->agora_user['id']) {
				Agora::showError('Permission denied');
				$this->redirect('!page');
				return;
			}
			
			$string = substr($post['subject'],0,3);
		
			if ($string != Agora::lang('RE')) {
				$subject_prefix = Agora::lang('RE');
				$this->view->assign('subject_prefix',$subject_prefix);
			}

			$this->helper('pathway')->add(Agora::lang('PMS'),Agora::makeURL(array('task'=>'pms')));
			$this->helper('pathway')->add(Agora::lang('Reply'),'');

			$this->view->assign('post',$post);
			$this->view->template = 'pms/reply';
		}
	}
?>
